/****************************************************************************
 * Copyright (C) 2025 Chenyz. All rights reserved.
 *
 * @file    TinyOS_FlagGroup.h
 *
 * @par     dependencies
 *          - stdint.h (Standard integer types)
 *          - TinyOS_Types.h (Type definitions)
 *
 * @author  Chenyz
 *
 * @brief   Flag Group Management Header
 *          This file provides declarations for event flag group operations
 *          in TinyOS, including:
 *          - Flag group initialization and configuration
 *          - Flag waiting with AND/OR conditions and consumption control
 *          - Flag setting and clearing operations
 *          - Flag group information and cleanup
 *
 * @version V1.0
 * @date    2025-09-04
 *
 * @note    This module implements event flag groups for multi-event
 *          synchronization with flexible condition matching.
 ****************************************************************************/

#ifndef __TINYOS_FLAGGROUP_H__
#define __TINYOS_FLAGGROUP_H__

/******************************** Includes **********************************/
#include <stdint.h>
#include "TinyOS_Types.h"

/*************************** Function Declarations **************************/

/* Flag group management functions */
void TinyOS_FlagGroupInit(
    TinyOS_FlagGroupType* FlagGroup,
    uint32_t Flags
);
uint32_t TinyOS_FlagGroupTake(
    TinyOS_FlagGroupType* FlagGroup, 
    uint32_t FlagType, 
    uint32_t RequestFlagMask, 
    uint32_t* ResultFlagMask, 
    uint32_t WaitTicks
);
uint32_t TinyOS_FlagGroupNoWaitTake(
    TinyOS_FlagGroupType* FlagGroup, 
    uint32_t FlagType, 
    uint32_t RequestFlagMask, 
    uint32_t* ResultFlagMask
);
void TinyOS_FlagGroupGive(
    TinyOS_FlagGroupType* FlagGroup, 
    uint8_t SetOrClear,
    uint32_t FlagMask
);
void TinyOS_FlagGroupGetInfo(
    TinyOS_FlagGroupType* FlagGroup,
    TinyOS_FlagGroupInfo* Info
);
uint32_t TinyOS_FlagGroupDelete(TinyOS_FlagGroupType* FlagGroup);

#endif /* __TINYOS_FLAGGROUP_H__ */

